package algo;

/**
 * 
 * @author Joris et Jordan
 * 
 */
public class Chemin {

	private Ville villeA, villeB;
	private double distance;
	private double pheromone;

	public Chemin(Ville villeA, Ville villeB) {
		super();
		this.villeA = villeA;
		this.villeB = villeB;
		this.distance = calculDistance(villeA, villeB);
		this.pheromone = 1;
	}

	private double carre(double a) {
		return a * a;
	}

	public double calculDistance(Ville ville1, Ville ville2) {
		return Math.sqrt(carre(ville2.getY() - ville1.getY())
				+ carre(ville2.getX() - ville1.getX()));
	}

	public void addPheromone(double phero) {
		pheromone += phero;
	}

	public void evaporation() {
		pheromone *= Fourmi.C;
	}

	public double getPheromone() {
		return pheromone;
	}

	public double getDensitePheromone() {
		return pheromone / distance;
	}

	public Ville getVilleA() {
		return villeA;
	}

	public Ville getVilleB() {
		return villeB;
	}

	public double getDistance() {
		return distance;
	}

}
